home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ha11 / ha.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  23.4 KB  |  736 lines

  1. VERSION 2.00
  2. Begin Form haForm 
  3.    BackColor       =   &H00808000&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Heap Alert 1.1"
  6.    ClientHeight    =   2100
  7.    ClientLeft      =   600
  8.    ClientTop       =   3600
  9.    ClientWidth     =   2160
  10.    Height          =   2505
  11.    Icon            =   HA.FRX:0000
  12.    Left            =   540
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   2100
  17.    ScaleWidth      =   2160
  18.    Top             =   3255
  19.    Width           =   2280
  20.    Begin CommandButton getInfo 
  21.       BackColor       =   &H00808000&
  22.       Caption         =   "&Sample"
  23.       FontBold        =   0   'False
  24.       FontItalic      =   0   'False
  25.       FontName        =   "MS Sans Serif"
  26.       FontSize        =   8.25
  27.       FontStrikethru  =   0   'False
  28.       FontUnderline   =   0   'False
  29.       Height          =   375
  30.       Left            =   1260
  31.       TabIndex        =   26
  32.       Top             =   1620
  33.       Width           =   795
  34.    End
  35.    Begin CheckBox autoSample 
  36.       BackColor       =   &H00808000&
  37.       Caption         =   "&Auto"
  38.       FontBold        =   0   'False
  39.       FontItalic      =   0   'False
  40.       FontName        =   "MS Sans Serif"
  41.       FontSize        =   8.25
  42.       FontStrikethru  =   0   'False
  43.       FontUnderline   =   0   'False
  44.       ForeColor       =   &H00000000&
  45.       Height          =   255
  46.       Left            =   1380
  47.       TabIndex        =   27
  48.       Top             =   1200
  49.       Value           =   1  'Checked
  50.       Width           =   675
  51.    End
  52.    Begin Timer sampleTimer 
  53.       Interval        =   4000
  54.       Left            =   1440
  55.       Top             =   720
  56.    End
  57.    Begin Label disabledDCCount 
  58.       Alignment       =   1  'Right Justify
  59.       BackColor       =   &H00808000&
  60.       FontBold        =   0   'False
  61.       FontItalic      =   0   'False
  62.       FontName        =   "MS Sans Serif"
  63.       FontSize        =   8.25
  64.       FontStrikethru  =   0   'False
  65.       FontUnderline   =   0   'False
  66.       ForeColor       =   &H00000000&
  67.       Height          =   195
  68.       Left            =   780
  69.       TabIndex        =   29
  70.       Top             =   2700
  71.       Width           =   375
  72.    End
  73.    Begin Label Label7 
  74.       BackColor       =   &H00808000&
  75.       Caption         =   "DisDCs:"
  76.       FontBold        =   0   'False
  77.       FontItalic      =   0   'False
  78.       FontName        =   "MS Sans Serif"
  79.       FontSize        =   8.25
  80.       FontStrikethru  =   0   'False
  81.       FontUnderline   =   0   'False
  82.       ForeColor       =   &H00000000&
  83.       Height          =   195
  84.       Left            =   60
  85.       TabIndex        =   33
  86.       Top             =   2700
  87.       Width           =   735
  88.    End
  89.    Begin Label metaDCCount 
  90.       Alignment       =   1  'Right Justify
  91.       BackColor       =   &H00808000&
  92.       FontBold        =   0   'False
  93.       FontItalic      =   0   'False
  94.       FontName        =   "MS Sans Serif"
  95.       FontSize        =   8.25
  96.       FontStrikethru  =   0   'False
  97.       FontUnderline   =   0   'False
  98.       ForeColor       =   &H00000000&
  99.       Height          =   195
  100.       Left            =   780
  101.       TabIndex        =   28
  102.       Top             =   2520
  103.       Width           =   375
  104.    End
  105.    Begin Label Label4 
  106.       BackColor       =   &H00808000&
  107.       Caption         =   "MetaDCs:"
  108.       FontBold        =   0   'False
  109.       FontItalic      =   0   'False
  110.       FontName        =   "MS Sans Serif"
  111.       FontSize        =   8.25
  112.       FontStrikethru  =   0   'False
  113.       FontUnderline   =   0   'False
  114.       ForeColor       =   &H00000000&
  115.       Height          =   195
  116.       Left            =   60
  117.       TabIndex        =   32
  118.       Top             =   2520
  119.       Width           =   735
  120.    End
  121.    Begin Label metafileCount 
  122.       Alignment       =   1  'Right Justify
  123.       BackColor       =   &H00808000&
  124.       FontBold        =   0   'False
  125.       FontItalic      =   0   'False
  126.       FontName        =   "MS Sans Serif"
  127.       FontSize        =   8.25
  128.       FontStrikethru  =   0   'False
  129.       FontUnderline   =   0   'False
  130.       ForeColor       =   &H00000000&
  131.       Height          =   195
  132.       Left            =   780
  133.       TabIndex        =   24
  134.       Top             =   2340
  135.       Width           =   375
  136.    End
  137.    Begin Label Label18 
  138.       BackColor       =   &H00808000&
  139.       Caption         =   "Metafiles:"
  140.       FontBold        =   0   'False
  141.       FontItalic      =   0   'False
  142.       FontName        =   "MS Sans Serif"
  143.       FontSize        =   8.25
  144.       FontStrikethru  =   0   'False
  145.       FontUnderline   =   0   'False
  146.       ForeColor       =   &H00000000&
  147.       Height          =   195
  148.       Left            =   60
  149.       TabIndex        =   16
  150.       Top             =   2340
  151.       Width           =   735
  152.    End
  153.    Begin Label otherCount 
  154.       Alignment       =   1  'Right Justify
  155.       BackColor       =   &H00808000&
  156.       FontBold        =   0   'False
  157.       FontItalic      =   0   'False
  158.       FontName        =   "MS Sans Serif"
  159.       FontSize        =   8.25
  160.       FontStrikethru  =   0   'False
  161.       FontUnderline   =   0   'False
  162.       ForeColor       =   &H00000000&
  163.       Height          =   195
  164.       Left            =   780
  165.       TabIndex        =   30
  166.       Top             =   1860
  167.       Width           =   375
  168.    End
  169.    Begin Label Label6 
  170.       BackColor       =   &H00808000&
  171.       Caption         =   "Other:"
  172.       FontBold        =   0   'False
  173.       FontItalic      =   0   'False
  174.       FontName        =   "MS Sans Serif"
  175.       FontSize        =   8.25
  176.       FontStrikethru  =   0   'False
  177.       FontUnderline   =   0   'False
  178.       ForeColor       =   &H00000000&
  179.       Height          =   195
  180.       Left            =   60
  181.       TabIndex        =   31
  182.       Top             =   1860
  183.       Width           =   735
  184.    End
  185.    Begin Label penCount 
  186.       Alignment       =   1  'Right Justify
  187.       BackColor       =   &H00808000&
  188.       FontBold        =   0   'False
  189.       FontItalic      =   0   'False
  190.       FontName        =   "MS Sans Serif"
  191.       FontSize        =   8.25
  192.       FontStrikethru  =   0   'False
  193.       FontUnderline   =   0   'False
  194.       ForeColor       =   &H00000000&
  195.       Height          =   195
  196.       Left            =   780
  197.       TabIndex        =   21
  198.       Top             =   1680
  199.       Width           =   375
  200.    End
  201.    Begin Label Label15 
  202.       BackColor       =   &H00808000&
  203.       Caption         =   "Pens:"
  204.       FontBold        =   0   'False
  205.       FontItalic      =   0   'False
  206.       FontName        =   "MS Sans Serif"
  207.       FontSize        =   8.25
  208.       FontStrikethru  =   0   'False
  209.       FontUnderline   =   0   'False
  210.       ForeColor       =   &H00000000&
  211.       Height          =   195
  212.       Left            =   60
  213.       TabIndex        =   13
  214.       Top             =   1680
  215.       Width           =   735
  216.    End
  217.    Begin Label paletteCount 
  218.       Alignment       =   1  'Right Justify
  219.       BackColor       =   &H00808000&
  220.       FontBold        =   0   'False
  221.       FontItalic      =   0   'False
  222.       FontName        =   "MS Sans Serif"
  223.       FontSize        =   8.25
  224.       FontStrikethru  =   0   'False
  225.       FontUnderline   =   0   'False
  226.       ForeColor       =   &H00000000&
  227.       Height          =   195
  228.       Left            =   780
  229.       TabIndex        =   25
  230.       Top             =   1500
  231.       Width           =   375
  232.    End
  233.    Begin Label Label19 
  234.       BackColor       =   &H00808000&
  235.       Caption         =   "Palettes:"
  236.       FontBold        =   0   'False
  237.       FontItalic      =   0   'False
  238.       FontName        =   "MS Sans Serif"
  239.       FontSize        =   8.25
  240.       FontStrikethru  =   0   'False
  241.       FontUnderline   =   0   'False
  242.       ForeColor       =   &H00000000&
  243.       Height          =   195
  244.       Left            =   60
  245.       TabIndex        =   17
  246.       Top             =   1500
  247.       Width           =   735
  248.    End
  249.    Begin Label regionCount 
  250.       Alignment       =   1  'Right Justify
  251.       BackColor       =   &H00808000&
  252.       FontBold        =   0   'False
  253.       FontItalic      =   0   'False
  254.       FontName        =   "MS Sans Serif"
  255.       FontSize        =   8.25
  256.       FontStrikethru  =   0   'False
  257.       FontUnderline   =   0   'False
  258.       ForeColor       =   &H00000000&
  259.       Height          =   195
  260.       Left            =   780
  261.       TabIndex        =   23
  262.       Top             =   1320
  263.       Width           =   375
  264.    End
  265.    Begin Label Label17 
  266.       BackColor       =   &H00808000&
  267.       Caption         =   "Regions:"
  268.       FontBold        =   0   'False
  269.       FontItalic      =   0   'False
  270.       FontName        =   "MS Sans Serif"
  271.       FontSize        =   8.25
  272.       FontStrikethru  =   0   'False
  273.       FontUnderline   =   0   'False
  274.       ForeColor       =   &H00000000&
  275.       Height          =   195
  276.       Left            =   60
  277.       TabIndex        =   15
  278.       Top             =   1320
  279.       Width           =   735
  280.    End
  281.    Begin Label brushCount 
  282.       Alignment       =   1  'Right Justify
  283.       BackColor       =   &H00808000&
  284.       FontBold        =   0   'False
  285.       FontItalic      =   0   'False
  286.       FontName        =   "MS Sans Serif"
  287.       FontSize        =   8.25
  288.       FontStrikethru  =   0   'False
  289.       FontUnderline   =   0   'False
  290.       ForeColor       =   &H00000000&
  291.       Height          =   195
  292.       Left            =   780
  293.       TabIndex        =   22
  294.       Top             =   1140
  295.       Width           =   375
  296.    End
  297.    Begin Label Label16 
  298.       BackColor       =   &H00808000&
  299.       Caption         =   "Brushes:"
  300.       FontBold        =   0   'False
  301.       FontItalic      =   0   'False
  302.       FontName        =   "MS Sans Serif"
  303.       FontSize        =   8.25
  304.       FontStrikethru  =   0   'False
  305.       FontUnderline   =   0   'False
  306.       ForeColor       =   &H00000000&
  307.       Height          =   195
  308.       Left            =   60
  309.       TabIndex        =   14
  310.       Top             =   1140
  311.       Width           =   735
  312.    End
  313.    Begin Label dcCount 
  314.       Alignment       =   1  'Right Justify
  315.       BackColor       =   &H00808000&
  316.       FontBold        =   0   'False
  317.       FontItalic      =   0   'False
  318.       FontName        =   "MS Sans Serif"
  319.       FontSize        =   8.25
  320.       FontStrikethru  =   0   'False
  321.       FontUnderline   =   0   'False
  322.       ForeColor       =   &H00000000&
  323.       Height          =   195
  324.       Left            =   780
  325.       TabIndex        =   20
  326.       Top             =   960
  327.       Width           =   375
  328.    End
  329.    Begin Label Label14 
  330.       BackColor       =   &H00808000&
  331.       Caption         =   "DCs:"
  332.       FontBold        =   0   'False
  333.       FontItalic      =   0   'False
  334.       FontName        =   "MS Sans Serif"
  335.       FontSize        =   8.25
  336.       FontStrikethru  =   0   'False
  337.       FontUnderline   =   0   'False
  338.       ForeColor       =   &H00000000&
  339.       Height          =   195
  340.       Left            =   60
  341.       TabIndex        =   12
  342.       Top             =   960
  343.       Width           =   735
  344.    End
  345.    Begin Label bitmapCount 
  346.       Alignment       =   1  'Right Justify
  347.       BackColor       =   &H00808000&
  348.       FontBold        =   0   'False
  349.       FontItalic      =   0   'False
  350.       FontName        =   "MS Sans Serif"
  351.       FontSize        =   8.25
  352.       FontStrikethru  =   0   'False
  353.       FontUnderline   =   0   'False
  354.       ForeColor       =   &H00000000&
  355.       Height          =   195
  356.       Left            =   780
  357.       TabIndex        =   19
  358.       Top             =   780
  359.       Width           =   375
  360.    End
  361.    Begin Label Label13 
  362.       BackColor       =   &H00808000&
  363.       Caption         =   "Bitmaps:"
  364.       FontBold        =   0   'False
  365.       FontItalic      =   0   'False
  366.       FontName        =   "MS Sans Serif"
  367.       FontSize        =   8.25
  368.       FontStrikethru  =   0   'False
  369.       FontUnderline   =   0   'False
  370.       ForeColor       =   &H00000000&
  371.       Height          =   195
  372.       Left            =   60
  373.       TabIndex        =   11
  374.       Top             =   780
  375.       Width           =   735
  376.    End
  377.    Begin Label fontCount 
  378.       Alignment       =   1  'Right Justify
  379.       BackColor       =   &H00808000&
  380.       FontBold        =   0   'False
  381.       FontItalic      =   0   'False
  382.       FontName        =   "MS Sans Serif"
  383.       FontSize        =   8.25
  384.       FontStrikethru  =   0   'False
  385.       FontUnderline   =   0   'False
  386.       ForeColor       =   &H00000000&
  387.       Height          =   195
  388.       Left            =   780
  389.       TabIndex        =   18
  390.       Top             =   600
  391.       Width           =   375
  392.    End
  393.    Begin Label Label12 
  394.       BackColor       =   &H00808000&
  395.       Caption         =   "Fonts:"
  396.       FontBold        =   0   'False
  397.       FontItalic      =   0   'False
  398.       FontName        =   "MS Sans Serif"
  399.       FontSize        =   8.25
  400.       FontStrikethru  =   0   'False
  401.       FontUnderline   =   0   'False
  402.       ForeColor       =   &H00000000&
  403.       Height          =   195
  404.       Left            =   60
  405.       TabIndex        =   10
  406.       Top             =   600
  407.       Width           =   735
  408.    End
  409.    Begin Label gdiPercent 
  410.       Alignment       =   1  'Right Justify
  411.       BackColor       =   &H00808000&
  412.       FontBold        =   0   'False
  413.       FontItalic      =   0   'False
  414.       FontName        =   "MS Sans Serif"
  415.       FontSize        =   8.25
  416.       FontStrikethru  =   0   'False
  417.       FontUnderline   =   0   'False
  418.       ForeColor       =   &H00000000&
  419.       Height          =   195
  420.       Left            =   1740
  421.       TabIndex        =   7
  422.       Top             =   420
  423.       Width           =   375
  424.    End
  425.    Begin Label gdiBytes 
  426.       Alignment       =   1  'Right Justify
  427.       BackColor       =   &H00808000&
  428.       FontBold        =   0   'False
  429.       FontItalic      =   0   'False
  430.       FontName        =   "MS Sans Serif"
  431.       FontSize        =   8.25
  432.       FontStrikethru  =   0   'False
  433.       FontUnderline   =   0   'False
  434.       ForeColor       =   &H00000000&
  435.       Height          =   195
  436.       Left            =   1200
  437.       TabIndex        =   5
  438.       Top             =   420
  439.       Width           =   495
  440.    End
  441.    Begin Label gdiCount 
  442.       Alignment       =   1  'Right Justify
  443.       BackColor       =   &H00808000&
  444.       FontBold        =   0   'False
  445.       FontItalic      =   0   'False
  446.       FontName        =   "MS Sans Serif"
  447.       FontSize        =   8.25
  448.       FontStrikethru  =   0   'False
  449.       FontUnderline   =   0   'False
  450.       ForeColor       =   &H00000000&
  451.       Height          =   195
  452.       Left            =   780
  453.       TabIndex        =   9
  454.       Top             =   420
  455.       Width           =   375
  456.    End
  457.    Begin Label Label2 
  458.       BackColor       =   &H00808000&
  459.       Caption         =   "GDI:"
  460.       FontBold        =   0   'False
  461.       FontItalic      =   0   'False
  462.       FontName        =   "MS Sans Serif"
  463.       FontSize        =   8.25
  464.       FontStrikethru  =   0   'False
  465.       FontUnderline   =   0   'False
  466.       ForeColor       =   &H00000000&
  467.       Height          =   195
  468.       Left            =   60
  469.       TabIndex        =   1
  470.       Top             =   420
  471.       Width           =   735
  472.    End
  473.    Begin Label userPercent 
  474.       Alignment       =   1  'Right Justify
  475.       BackColor       =   &H00808000&
  476.       FontBold        =   0   'False
  477.       FontItalic      =   0   'False
  478.       FontName        =   "MS Sans Serif"
  479.       FontSize        =   8.25
  480.       FontStrikethru  =   0   'False
  481.       FontUnderline   =   0   'False
  482.       ForeColor       =   &H00000000&
  483.       Height          =   195
  484.       Left            =   1740
  485.       TabIndex        =   6
  486.       Top             =   240
  487.       Width           =   375
  488.    End
  489.    Begin Label userBytes 
  490.       Alignment       =   1  'Right Justify
  491.       BackColor       =   &H00808000&
  492.       FontBold        =   0   'False
  493.       FontItalic      =   0   'False
  494.       FontName        =   "MS Sans Serif"
  495.       FontSize        =   8.25
  496.       FontStrikethru  =   0   'False
  497.       FontUnderline   =   0   'False
  498.       ForeColor       =   &H00000000&
  499.       Height          =   195
  500.       Left            =   1200
  501.       TabIndex        =   4
  502.       Top             =   240
  503.       Width           =   495
  504.    End
  505.    Begin Label userCount 
  506.       Alignment       =   1  'Right Justify
  507.       BackColor       =   &H00808000&
  508.       FontBold        =   0   'False
  509.       FontItalic      =   0   'False
  510.       FontName        =   "MS Sans Serif"
  511.       FontSize        =   8.25
  512.       FontStrikethru  =   0   'False
  513.       FontUnderline   =   0   'False
  514.       ForeColor       =   &H00000000&
  515.       Height          =   195
  516.       Left            =   780
  517.       TabIndex        =   8
  518.       Top             =   240
  519.       Width           =   375
  520.    End
  521.    Begin Label Label1 
  522.       BackColor       =   &H00808000&
  523.       Caption         =   "User:"
  524.       FontBold        =   0   'False
  525.       FontItalic      =   0   'False
  526.       FontName        =   "MS Sans Serif"
  527.       FontSize        =   8.25
  528.       FontStrikethru  =   0   'False
  529.       FontUnderline   =   0   'False
  530.       ForeColor       =   &H00000000&
  531.       Height          =   195
  532.       Left            =   60
  533.       TabIndex        =   0
  534.       Top             =   240
  535.       Width           =   735
  536.    End
  537.    Begin Label Label8 
  538.       BackColor       =   &H00808000&
  539.       Caption         =   "Free:"
  540.       FontBold        =   0   'False
  541.       FontItalic      =   0   'False
  542.       FontName        =   "MS Sans Serif"
  543.       FontSize        =   8.25
  544.       FontStrikethru  =   0   'False
  545.       FontUnderline   =   0   'False
  546.       ForeColor       =   &H00000000&
  547.       Height          =   195
  548.       Left            =   1740
  549.       TabIndex        =   34
  550.       Top             =   60
  551.       Width           =   375
  552.    End
  553.    Begin Label Label3 
  554.       Alignment       =   2  'Center
  555.       BackColor       =   &H00808000&
  556.       Caption         =   "Used:"
  557.       FontBold        =   0   'False
  558.       FontItalic      =   0   'False
  559.       FontName        =   "MS Sans Serif"
  560.       FontSize        =   8.25
  561.       FontStrikethru  =   0   'False
  562.       FontUnderline   =   0   'False
  563.       ForeColor       =   &H00000000&
  564.       Height          =   195
  565.       Left            =   1200
  566.       TabIndex        =   2
  567.       Top             =   60
  568.       Width           =   495
  569.    End
  570.    Begin Label Label5 
  571.       Alignment       =   2  'Center
  572.       BackColor       =   &H00808000&
  573.       Caption         =   "#"
  574.       FontBold        =   0   'False
  575.       FontItalic      =   0   'False
  576.       FontName        =   "MS Sans Serif"
  577.       FontSize        =   8.25
  578.       FontStrikethru  =   0   'False
  579.       FontUnderline   =   0   'False
  580.       ForeColor       =   &H00000000&
  581.       Height          =   195
  582.       Left            =   780
  583.       TabIndex        =   3
  584.       Top             =   60
  585.       Width           =   375
  586.    End
  587. Sub autoSample_Click ()
  588.   If autoSample.value = 1 Then
  589.     sampleTimer.enabled = -1
  590.   Else
  591.     sampleTimer.enabled = 0
  592.   End If
  593. End Sub
  594. Sub Form_Load ()
  595.   V& = GetVersion()
  596.   WindowsVersion% = V& And 65535
  597.   Major% = WindowsVersion% And 255
  598.   Minor% = (WindowsVersion% / 256) And 255
  599.   If Major% >= 3 And Minor% >= 10 Then
  600.     screen.mousePointer = 11
  601.     iUserHeap% = 0
  602.     iGDIHeap% = 0
  603.     haForm.left = 0
  604.     haForm.top = 0
  605.     Call retrieveData
  606.     screen.mousePointer = 0
  607.   Else
  608.     MsgBox "Heap Alert 1.1 Requires at least Windows 3.1 commercial."
  609.     End
  610.   End If
  611. End Sub
  612. Sub getInfo_Click ()
  613.   Call retrieveData
  614. End Sub
  615. Function makeLong (ByVal i%) As Long
  616.   ' Visual Basic needs unsigned integers!
  617.   If i% < 0 Then
  618.     makeLong = CLng(32767) + (CLng(32769) + CLng(i%))
  619.   Else
  620.     makeLong = CLng(i%)
  621.   End If
  622. End Function
  623. Sub retrieveData ()
  624.   Dim le As sLOCALENTRY
  625.   Dim sh As sSYSHEAPINFO
  626.   Dim ge As sGLOBALENTRY
  627.   ' initialize the sizes of these structures
  628.   le.dwSize = Len(le)
  629.   sh.dwSize = Len(sh)
  630.   ge.dwSize = Len(ge)
  631.   iFonts% = 0
  632.   iBitmaps% = 0
  633.   iDCs% = 0
  634.   iPens% = 0
  635.   iBrushes% = 0
  636.   iRegions% = 0
  637.   iMetafiles% = 0
  638.   iPalettes% = 0
  639.   iMetaDC% = 0
  640.   iDisabledDC% = 0
  641.   iOther% = 0
  642.   gb& = 0
  643.   gc& = 0
  644.   ub& = 0
  645.   uc& = 0
  646.   r% = SystemHeapInfo(sh)
  647.   ' find the User and GDI heaps, but only the first time
  648.   ' in 3.0 the heaps are 1 greater than sh.hX
  649.   ' in 3.1 the heaps are 1 less than sh.hX
  650.   If iUserHeap% = 0 Or iGDIHeap% = 0 Then
  651.     r% = GlobalFirst(ge, GLOBAL_ALL)
  652.     While r% <> 0 And (iUserHeap% = 0 Or iGDIHeap% = 0)
  653.       If ge.wHeapPresent = 1 Then
  654.         q% = LocalFirst(le, ge.hBlock)
  655.         If le.wHeapType = USER_HEAP Then
  656.           iUserHeap% = ge.hBlock
  657.         ElseIf le.wHeapType = GDI_HEAP Then
  658.           iGDIHeap% = ge.hBlock
  659.         End If
  660.       End If
  661.       r% = GlobalNext(ge, GLOBAL_ALL)
  662.     Wend
  663.   End If
  664.   ' walk the User heap
  665.   If iUserHeap% <> 0 Then
  666.     q% = LocalFirst(le, iUserHeap%)
  667.     While q% <> 0
  668.       If le.wFlags <> LF_FREE Then
  669.         uc& = uc& + 1
  670.         ub& = ub& + makeLong(le.wSize)
  671.       End If
  672.       q% = LocalNext(le)
  673.     Wend
  674.   End If
  675.   ' walk the GDI heap
  676.   If iGDIHeap% <> 0 Then
  677.     q% = LocalFirst(le, iGDIHeap%)
  678.     While q% <> 0
  679.       If le.wFlags <> LF_FREE Then
  680.         gc& = gc& + 1
  681.         gb& = gb& + makeLong(le.wSize)
  682.         Select Case le.wType
  683.           Case LT_GDI_FONT
  684.             iFonts% = iFonts% + 1
  685.           Case LT_GDI_BITMAP
  686.             iBitmaps% = iBitmaps% + 1
  687.           Case LT_GDI_DC
  688.             iDCs% = iDCs% + 1
  689.           Case LT_GDI_PEN
  690.             iPens% = iPens% + 1
  691.           Case LT_GDI_BRUSH
  692.             iBrushes% = iBrushes% + 1
  693.           Case LT_GDI_RGN
  694.             iRegions% = iRegions% + 1
  695.           Case LT_GDI_METAFILE
  696.             ' for some reason, 3.1 counts metafiles as "other"
  697.             iMetafiles% = iMetafiles% + 1
  698.           Case LT_GDI_PALETTE
  699.             iPalettes% = iPalettes% + 1
  700.           Case LT_GDI_METADC
  701.             iMetaDC% = iMetaDC% + 1
  702.           Case LT_GDI_DISABLED_DC
  703.             iDisabledDC% = iDisabledDC% + 1
  704.           Case LT_NORMAL
  705.             iOther% = iOther% + 1
  706.         End Select
  707.       End If
  708.       q% = LocalNext(le)
  709.     Wend
  710.   End If
  711.   gdiCount.caption = LTrim$(Str$(gc&))
  712.   userCount.caption = LTrim$(Str$(uc&))
  713.   gdiBytes.caption = LTrim$(Str$(gb&))
  714.   userBytes.caption = LTrim$(Str$(ub&))
  715.   fontCount.caption = LTrim$(Str$(iFonts%))
  716.   bitmapCount.caption = LTrim$(Str$(iBitmaps%))
  717.   dcCount.caption = LTrim$(Str$(iDCs%))
  718.   penCount.caption = LTrim$(Str$(iPens%))
  719.   brushCount.caption = LTrim$(Str$(iBrushes%))
  720.   regionCount.caption = LTrim$(Str$(iRegions%))
  721.   metafileCount.caption = LTrim$(Str$(iMetafiles%))
  722.   paletteCount.caption = LTrim$(Str$(iPalettes%))
  723.   metaDCCount.caption = LTrim$(Str$(iMetaDC%))
  724.   disabledDCCount.caption = LTrim$(Str$(iDisabledDC%))
  725.   otherCount.caption = LTrim$(Str$(iOther%))
  726.   ' not sure why these numbers don't come out the same.
  727.   ' according to the documentation they should.
  728.   'userPercent.caption = LTrim$(Str$(100-CInt(100 * CSng(ub&) / 65536!))) + "%"
  729.   'gdiPercent.caption = LTrim$(Str$(100-CInt(100 * CSng(gb&) / 65536!))) + "%"
  730.   userPercent.caption = LTrim$(Str$(sh.wUserFreePercent)) + "%"
  731.   gdiPercent.caption = LTrim$(Str$(sh.wGDIFreePercent)) + "%"
  732. End Sub
  733. Sub sampleTimer_Timer ()
  734.   Call retrieveData
  735. End Sub
  736.